package com.example.demo.controller;

import com.example.demo.pojo.Address;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@Tag(name = "request",description = "request")
public class ResponseController {

    @RequestMapping ("/hello")
    @Operation(description = "hello")
    public String hello(){
        System.out.println("hello word ~");
        return "Hello word ~";
    }

    @RequestMapping ("/getAddr")
    @Operation(description = "addr")
    public Address getAddr(){
        Address addr = new Address();
        addr.setCity("北京");
        addr.setAddress("广州");
        return addr;
    }

    @RequestMapping ("/listAddr")
    @Operation(description = "listaddr")
    public List<Address> listAddr(){
        List<Address> list = new ArrayList<>();
        Address addr = new Address();
        addr.setCity("北京");
        addr.setAddress("广州");
        Address addr2 = new Address();
        addr2.setCity("重庆");
        addr2.setAddress("西安");

        list.add(addr);
        list.add(addr2);
        return list;
    }
}
